package com.qingcloud.base.feign;

import com.qingcloud.base.constant.AppNameConstant;
import com.qingcloud.base.feign.factory.UserServiceFallbackFactory;
import com.qingcloud.base.remote.pojo.LoginUserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@FeignClient(contextId = "userService", path = "backend", value = AppNameConstant.APP_ADMIN, fallbackFactory = UserServiceFallbackFactory.class)
public interface UserService {
    /**
     * 根据用户名获取用户登录信息  包括 ROLE
     * @param userName  可以为 username ,workemail ,mobileno
     * @return
     */
    @GetMapping(value = "api/findUser/{userName}")
    LoginUserDTO findUserByName(@PathVariable("userName") String userName);

    /**
     * 根据用户ID查询用户信息
     */
    @GetMapping(value = "api/findUserByUserId/{userId}")
    LoginUserDTO findUserByUserId(@PathVariable("userId") String userId);

}
